<form id="wgt_user_login_form" name="wgt_user_login_form" action="user.php?act=check" method="post">
    <p><label for="wgt_user_username">id pengguna: </label><input id="wgt_user_username" type="text" name="wgt_user_username"/></p>
    <p><label for="wgt_user_password">kata sandi: </label><input id="wgt_user_password" type="password" name="wgt_user_password"/></p>
    <p><input type="submit" name="submit" value="masuk"/></p>
    <p id="wgt_user_message" class="wgt_user_message"></p>
</form>
<script type="text/javascript">
$(function(){
    var wgt_user_login_result = function(data){
        if(data.result) {
            window.location = window.location;
        } else {
            $('#wgt_user_message').html(data.message).fadeIn();
        }
    };

    $('#wgt_user_login_form').submit(function(e){
        e.preventDefault();
        e.stopPropagation();

        $.post('user.php?act=check_login', $('#wgt_user_login_form').serializeArray(), wgt_user_login_result, "json");
    });

    $('#wgt_user_message').hide();
});
</script>